/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package DZBall;

import java.io.IOException;
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;



/**
 * @author dave
 */
public class Game extends MIDlet implements CommandListener {

    private GameC gameC;
    private Command exitCommand;

    public void startApp() {
        if (gameC == null) {
            try {
                gameC = new GameC();
            } catch (IOException ex) {
                ex.printStackTrace();
            }
            exitCommand = new Command("Salir", Command.EXIT, 1);
            gameC.addCommand(exitCommand);
            gameC.setCommandListener(this);
        }
        Display.getDisplay(this).setCurrent(gameC);
        gameC.start();
    }

    public void pauseApp() {
    }

    public void destroyApp(boolean unconditional) {
    }

    public void commandAction(Command c, Displayable d) {
        if(c == exitCommand)
            destroyApp(false);
            notifyDestroyed();
    }
}
